# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[import gdata.service
self.service = gdata.service.GDataService(server='gdata.youtube.com')
self.url_open = None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e65ac>}
nname: 50
n 50(None)[base_uri = 'http://www.youtube.com'
uri_values = video_uri.split('?', 1)[1].split('=')
player_site = self.url_open(video_uri)
data = player_site.read()
idx = data.index('"t":')
data = data[idx + 5:idx + 200].lstrip(' "')
_t_arg = data[:data.index('"')]
del data
vid_id = uri_values[uri_values.index('v') + 1]
request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
request.add_header('User-Agent', 'WyWideWeb/1.0')
site = self.url_open(request)
return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')
]:
	i: 9(), 49()
	o: 

nname: 49
n 49(None)[]:
	i: 0(t)
	o: 50()

nname: 9
n 9(None)[self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
]:
	i: 0(f)
	o: 50()

nname: 0
n 0(self.url_open)[]:
	i: 
	o: 9(f), 49(t)

nname: 0
n 0(None)[if not self.url_open:
	self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
base_uri = 'http://www.youtube.com'
uri_values = video_uri.split('?', 1)[1].split('=')
player_site = self.url_open(video_uri)
data = player_site.read()
idx = data.index('"t":')
data = data[idx + 5:idx + 200].lstrip(' "')
_t_arg = data[:data.index('"')]
del data
vid_id = uri_values[uri_values.index('v') + 1]
request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
request.add_header('User-Agent', 'WyWideWeb/1.0')
site = self.url_open(request)
return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76edc4c>}
nname: 0
n 0(None)[return self.service.Get('/feeds/api/' + path).entry
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e4e2c>}
nname: 0
n 0(None)[return self._get_flv_uri(uri)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8b5f82c>}
nname: 0
n 0(None)[return self._get_flv_uri(uri)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8b6364c>}
nname: 0
n 0(None)[return self._get_flv_uri(uri)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8b5f98c>}
nname: 303
n 303(None)[return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')
]:
	i: 285(), 299()
	o: 

nname: 299
n 299(None)[]:
	i: 137(f)
	o: 303()

nname: 285
n 285(None)[]:
	i: 137(t)
	o: 303()

nname: 137
n 137(rating_ext is not None)[]:
	i: 86(), 122(), 135(AE)
	o: 285(t), 299(f)

nname: 135
n 135(None)[]:
	i: 112(f)
	o: 137(AE)

nname: 122
n 122(None)[rating_ext = None
]:
	i: 112(t)
	o: 137()

nname: 112
n 112(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 83(except)
	o: 122(t), 135(f)

nname: 86
n 86(None)[rating_ext = e.FindExtensions(tag='rating')[0]
]:
	i: 83(try)
	o: 137()

nname: 83
n 83(None)[]:
	i: 25(), 68(), 81(AE)
	o: 86(try), 112(except)

nname: 81
n 81(None)[]:
	i: 58(f)
	o: 83(AE)

nname: 68
n 68(None)[view_count = 'NA'
]:
	i: 58(t)
	o: 83()

nname: 58
n 58(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 0(except)
	o: 68(t), 81(f)

nname: 25
n 25(None)[view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
]:
	i: 0(try)
	o: 83()

nname: 0
n 0(None)[group_ext = e.FindExtensions(tag='group')[0]
]:
	i: 
	o: 25(try), 58(except)

nname: 137
n 137(None)[if rating_ext is not None:
	pass
return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')
]:
	i: 86()
	o: 

nname: 86
n 86(None)[try:
	rating_ext = e.FindExtensions(tag='rating')[0]
except IndexError:
	rating_ext = None
]:
	i: 58(try)
	o: 137()

nname: 58
n 58(None)[except IndexError:
	view_count = 'NA'
]:
	i: 0()
	o: 86(try)

nname: 0
n 0(None)[group_ext = e.FindExtensions(tag='group')[0]
try:
	view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
]:
	i: 
	o: 58()

nname: 86
n 86(None)[try:
	rating_ext = e.FindExtensions(tag='rating')[0]
except IndexError:
	rating_ext = None
if rating_ext is not None:
	pass
return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')
]:
	i: 0(try)
	o: 

nname: 0
n 0(None)[group_ext = e.FindExtensions(tag='group')[0]
try:
	view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
except IndexError:
	view_count = 'NA'
]:
	i: 
	o: 86(try)

nname: 0
n 0(None)[group_ext = e.FindExtensions(tag='group')[0]
try:
	view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
except IndexError:
	view_count = 'NA'
try:
	rating_ext = e.FindExtensions(tag='rating')[0]
except IndexError:
	rating_ext = None
if rating_ext is not None:
	pass
return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76ede8c>}
nname: 55
n 55(None)[del _[1]
return self._get_entries('videos/-/' + quote_plus(name))
]:
	i: 0(AF), 33()
	o: 

nname: 33
n 33(None)[for e in self._get_entries('videos/-/' + quote_plus(name)):
]:
	i: 0(for)
	o: 55()

nname: 0
n 0(None)[]:
	i: 
	o: 33(for), 55(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e4f4c>, 33: <unpyclib.structure.node instance at 0xb76e4f6c>, 55: <unpyclib.structure.node instance at 0xb76edecc>}
nname: 305
n 305(None)[del _[1]
return self._get_entries('%s?%s' % (root_uri, urlencode(params)))
]:
	i: 221(AF), 301()
	o: 

nname: 301
n 301(None)[]:
	i: 260(t), 281()
	o: 305()

nname: 281
n 281(None)[continue
]:
	i: 260(f)
	o: 301()

nname: 260
n 260(e.FindExtensions(tag='noembed'))[for e in self._get_entries('%s?%s' % (root_uri, urlencode(params))):
]:
	i: 221(for)
	o: 281(f), 301(t)

nname: 221
n 221(None)[]:
	i: 206(), 220()
	o: 260(for), 305(AF)

nname: 220
n 220(None)[]:
	i: 194(f)
	o: 221()

nname: 206
n 206(None)[_[1], params['orderby'] = [], orderby
]:
	i: 194(t)
	o: 221()

nname: 194
n 194(orderby is not None)[]:
	i: 163(), 193()
	o: 206(t), 220(f)

nname: 193
n 193(None)[]:
	i: 138&150(f)
	o: 194()

nname: 163
n 163(None)[params['lr'] = lang
params['restriction'] = lang.upper()
]:
	i: 138&150(t)
	o: 194()

nname: 138&150
n 138&150(lang is not None and 'vq' in params)[]:
	i: 79(), 121()
	o: 163(t), 193(f)

nname: 121
n 121(None)[params['vq'] = what
root_uri = 'videos'
]:
	i: 56(f)
	o: 138&150()

nname: 79
n 79(None)[root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
]:
	i: 56(t)
	o: 138&150()

nname: 56
n 56(isinstance(what, int))[params = {'start-index': 1, 'max-results': 50}
]:
	i: 45(), 52()
	o: 79(t), 121(f)

nname: 52
n 52(None)[]:
	i: 27(f)
	o: 56()

nname: 45
n 45(None)[]:
	i: 27(t)
	o: 56()

nname: 27
n 27(max_res <= 50)[]:
	i: 16(), 23()
	o: 45(t), 52(f)

nname: 23
n 23(None)[]:
	i: 0(f)
	o: 27()

nname: 16
n 16(None)[]:
	i: 0(t)
	o: 27()

nname: 0
n 0(start_idx > 0)[]:
	i: 
	o: 16(t), 23(f)

nname: 305
n 305(None)[del _[1]
return self._get_entries('%s?%s' % (root_uri, urlencode(params)))
]:
	i: 194(AF), 260()
	o: 

nname: 260
n 260(None)[for e in self._get_entries('%s?%s' % (root_uri, urlencode(params))):
if not e.FindExtensions(tag='noembed'):
	continue
]:
	i: 194(for)
	o: 305()

nname: 194
n 194(None)[if orderby is not None:
	_[1], params['orderby'] = [], orderby
]:
	i: 56()
	o: 260(for), 305(AF)

nname: 56
n 56(None)[params = {'start-index': 1, 'max-results': 50}
if isinstance(what, int):
	root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
else:
	params['vq'] = what
	root_uri = 'videos'
if lang is not None and 'vq' in params:
	params['lr'] = lang
	params['restriction'] = lang.upper()
]:
	i: 0()
	o: 194()

nname: 0
n 0(None)[if start_idx > 0:
	pass
if max_res <= 50:
	pass
]:
	i: 
	o: 56()

nname: 305
n 305(None)[del _[1]
return self._get_entries('%s?%s' % (root_uri, urlencode(params)))
]:
	i: 194(AF), 260()
	o: 

nname: 260
n 260(None)[for e in self._get_entries('%s?%s' % (root_uri, urlencode(params))):
if not e.FindExtensions(tag='noembed'):
	continue
]:
	i: 194(for)
	o: 305()

nname: 194
n 194(None)[if orderby is not None:
	_[1], params['orderby'] = [], orderby
]:
	i: 0()
	o: 260(for), 305(AF)

nname: 0
n 0(None)[if start_idx > 0:
	pass
if max_res <= 50:
	pass
params = {'start-index': 1, 'max-results': 50}
if isinstance(what, int):
	root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
else:
	params['vq'] = what
	root_uri = 'videos'
if lang is not None and 'vq' in params:
	params['lr'] = lang
	params['restriction'] = lang.upper()
]:
	i: 
	o: 194()

nname: 305
n 305(None)[del _[1]
return self._get_entries('%s?%s' % (root_uri, urlencode(params)))
]:
	i: 0(AF), 260()
	o: 

nname: 260
n 260(None)[for e in self._get_entries('%s?%s' % (root_uri, urlencode(params))):
if not e.FindExtensions(tag='noembed'):
	continue
]:
	i: 0(for)
	o: 305()

nname: 0
n 0(None)[if start_idx > 0:
	pass
if max_res <= 50:
	pass
params = {'start-index': 1, 'max-results': 50}
if isinstance(what, int):
	root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
else:
	params['vq'] = what
	root_uri = 'videos'
if lang is not None and 'vq' in params:
	params['lr'] = lang
	params['restriction'] = lang.upper()
if orderby is not None:
	_[1], params['orderby'] = [], orderby
]:
	i: 
	o: 260(for), 305(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76edeec>, 260: <unpyclib.structure.node instance at 0xb76edf6c>, 305: <unpyclib.structure.node instance at 0x8b5fb2c>}
nname: 6
n 6(None)[__metaclass__ = MetaSingleton
def __init__(self):
	import gdata.service
	self.service = gdata.service.GDataService(server='gdata.youtube.com')
	self.url_open = None
	return None

_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
def _get_flv_uri(self, video_uri):
	if not self.url_open:
		self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
	base_uri = 'http://www.youtube.com'
	uri_values = video_uri.split('?', 1)[1].split('=')
	player_site = self.url_open(video_uri)
	data = player_site.read()
	idx = data.index('"t":')
	data = data[idx + 5:idx + 200].lstrip(' "')
	_t_arg = data[:data.index('"')]
	del data
	vid_id = uri_values[uri_values.index('v') + 1]
	request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
	request.add_header('User-Agent', 'WyWideWeb/1.0')
	site = self.url_open(request)
	return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

def _get_entries(self, path):
	return self.service.Get('/feeds/api/' + path).entry

def _get_dict_from_entry(self, e):
	group_ext = e.FindExtensions(tag='group')[0]
	try:
		view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
	except IndexError:
		view_count = 'NA'
	try:
		rating_ext = e.FindExtensions(tag='rating')[0]
	except IndexError:
		rating_ext = None
	if rating_ext is not None:
		pass
	return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

def simple_search(self, name):
	pass

def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
	if start_idx > 0:
		pass
	if max_res <= 50:
		pass
	params = {'start-index': 1, 'max-results': 50}
	if isinstance(what, int):
		root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
	else:
		params['vq'] = what
		root_uri = 'videos'
	if lang is not None and 'vq' in params:
		params['lr'] = lang
		params['restriction'] = lang.upper()
	if orderby is not None:
		_[1], params['orderby'] = [], orderby

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76e4b0c>}
nname: 503
n 503(None)[]:
	i: 305(JA), 425(AL), 499(), 502()
	o: 

nname: 502
n 502(None)[]:
	i: 0(f)
	o: 503()

nname: 499
n 499(None)[]:
	i: 224(AL), 498()
	o: 503()

nname: 498
n 498(None)[]:
	i: 428(AF), 462()
	o: 499()

nname: 462
n 462(None)[for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
print e
print 'URI:',
print e['uri']()
print '#' * 80
]:
	i: 428(for)
	o: 498()

nname: 428
n 428(None)[]:
	i: 425(loop)
	o: 462(for), 498(AF)

nname: 425
n 425(None)[]:
	i: 309(AL), 424()
	o: 428(loop), 503(AL)

nname: 424
n 424(None)[]:
	i: 313(AF), 421()
	o: 425()

nname: 421
n 421(None)[]:
	i: 329(AL), 420()
	o: 424()

nname: 420
n 420(None)[]:
	i: 350(AF), 384()
	o: 421()

nname: 384
n 384(None)[for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
print e
print 'URI:',
print e['uri']()
print '#' * 80
]:
	i: 350(for)
	o: 420()

nname: 350
n 350(None)[]:
	i: 329(loop)
	o: 384(for), 420(AF)

nname: 329
n 329(None)[for i, name in enumerate(YoutubeData._standard_feeds):
print 'FEED',
print name
]:
	i: 313(for)
	o: 350(loop), 421(AL)

nname: 313
n 313(None)[]:
	i: 309(loop)
	o: 329(for), 424(AF)

nname: 309
n 309(None)[]:
	i: 93(f)
	o: 313(loop), 425(AL)

nname: 305
n 305(None)[]:
	i: 227(AF), 261()
	o: 503(JA)

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 305()

nname: 227
n 227(None)[]:
	i: 224(loop)
	o: 261(for), 305(AF)

nname: 224
n 224(None)[]:
	i: 178(), 201()
	o: 227(loop), 499(AL)

nname: 201
n 201(None)[what = ' '.join(sys.argv[1:])
]:
	i: 136&158(f)
	o: 224()

nname: 178
n 178(None)[what = int(sys.argv[1])
]:
	i: 136&158(t)
	o: 224()

nname: 136&158
n 136&158(len(sys.argv) == 2 and sys.argv[1].isdigit())[]:
	i: 93(t)
	o: 178(t), 201(f)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 502(f)

nname: 503
n 503(None)[]:
	i: 425(AL), 227(AF), 261(), 136&158(AL), 428(AF), 462(), 0(f)
	o: 

nname: 462
n 462(None)[for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
print e
print 'URI:',
print e['uri']()
print '#' * 80
]:
	i: 428(for)
	o: 503()

nname: 428
n 428(None)[]:
	i: 425(loop)
	o: 462(for), 503(AF)

nname: 425
n 425(None)[]:
	i: 309(AL), 313(AF), 384()
	o: 428(loop), 503(AL)

nname: 384
n 384(None)[for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 329(for)
	o: 425()

nname: 329
n 329(None)[for i, name in enumerate(YoutubeData._standard_feeds):
print 'FEED',
print name
]:
	i: 313(for)
	o: 384(for)

nname: 313
n 313(None)[]:
	i: 309(loop)
	o: 329(for), 425(AF)

nname: 309
n 309(None)[]:
	i: 93(f)
	o: 313(loop), 425(AL)

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 503()

nname: 227
n 227(None)[]:
	i: 136&158(loop)
	o: 261(for), 503(AF)

nname: 136&158
n 136&158(None)[if len(sys.argv) == 2 and sys.argv[1].isdigit():
	what = int(sys.argv[1])
else:
	what = ' '.join(sys.argv[1:])
]:
	i: 93(t)
	o: 227(loop), 503(AL)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 503(f)

nname: 503
n 503(None)[]:
	i: 227(AF), 261(), 136&158(AL), 462(), 0(f)
	o: 

nname: 462
n 462(None)[for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 425(for)
	o: 503()

nname: 425
n 425(None)[]:
	i: 309(AL), 313(AF), 329()
	o: 462(for)

nname: 329
n 329(None)[for i, name in enumerate(YoutubeData._standard_feeds):
print 'FEED',
print name
for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 313(for)
	o: 425()

nname: 313
n 313(None)[]:
	i: 309(loop)
	o: 329(for), 425(AF)

nname: 309
n 309(None)[]:
	i: 93(f)
	o: 313(loop), 425(AL)

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 503()

nname: 227
n 227(None)[]:
	i: 136&158(loop)
	o: 261(for), 503(AF)

nname: 136&158
n 136&158(None)[if len(sys.argv) == 2 and sys.argv[1].isdigit():
	what = int(sys.argv[1])
else:
	what = ' '.join(sys.argv[1:])
]:
	i: 93(t)
	o: 227(loop), 503(AL)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 503(f)

nname: 503
n 503(None)[]:
	i: 227(AF), 261(), 136&158(AL), 462(), 0(f)
	o: 

nname: 462
n 462(None)[for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 329(for)
	o: 503()

nname: 329
n 329(None)[for i, name in enumerate(YoutubeData._standard_feeds):
	print 'FEED',
	print name
	for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
		print e
		print 'URI:',
		print e['uri']()
		print '#' * 80
]:
	i: 309(for)
	o: 462(for)

nname: 309
n 309(None)[]:
	i: 93(f)
	o: 329(for)

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 503()

nname: 227
n 227(None)[]:
	i: 136&158(loop)
	o: 261(for), 503(AF)

nname: 136&158
n 136&158(None)[if len(sys.argv) == 2 and sys.argv[1].isdigit():
	what = int(sys.argv[1])
else:
	what = ' '.join(sys.argv[1:])
]:
	i: 93(t)
	o: 227(loop), 503(AL)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 503(f)

nname: 503
n 503(None)[]:
	i: 227(AF), 261(), 136&158(AL), 462(), 0(f)
	o: 

nname: 462
n 462(None)[for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 309(for)
	o: 503()

nname: 309
n 309(None)[for i, name in enumerate(YoutubeData._standard_feeds):
	print 'FEED',
	print name
	for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
		print e
		print 'URI:',
		print e['uri']()
		print '#' * 80
]:
	i: 93(f)
	o: 462(for)

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 503()

nname: 227
n 227(None)[]:
	i: 136&158(loop)
	o: 261(for), 503(AF)

nname: 136&158
n 136&158(None)[if len(sys.argv) == 2 and sys.argv[1].isdigit():
	what = int(sys.argv[1])
else:
	what = ' '.join(sys.argv[1:])
]:
	i: 93(t)
	o: 227(loop), 503(AL)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 503(f)

nname: 503
n 503(None)[]:
	i: 227(AF), 261(), 136&158(AL), 309(), 0(f)
	o: 

nname: 309
n 309(None)[for i, name in enumerate(YoutubeData._standard_feeds):
	print 'FEED',
	print name
	for e in ytd.search(i, lang='fr', max_res=5, orderby='viewCount'):
		print e
		print 'URI:',
		print e['uri']()
		print '#' * 80
for e in ytd.search('Pixar', lang='fr', orderby='viewCount', max_res=10):
	print e
	print 'URI:',
	print e['uri']()
	print '#' * 80
]:
	i: 93(f)
	o: 503()

nname: 261
n 261(None)[for e in ytd.search(what, lang='fr', max_res=5, orderby='viewCount'):
print '%(title)s rated: %(rating)s / viewed: %(view_count)s' % e
print e['uri'](),
print '|',
print e['thumbnail']
print '...'
]:
	i: 227(for)
	o: 503()

nname: 227
n 227(None)[]:
	i: 136&158(loop)
	o: 261(for), 503(AF)

nname: 136&158
n 136&158(None)[if len(sys.argv) == 2 and sys.argv[1].isdigit():
	what = int(sys.argv[1])
else:
	what = ' '.join(sys.argv[1:])
]:
	i: 93(t)
	o: 227(loop), 503(AL)

nname: 93
n 93(len(sys.argv) > 1)[import sys
ytd = YoutubeData()
]:
	i: 0(t)
	o: 136&158(t), 309(f)

nname: 0
n 0(__name__ == '__main__')[__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



]:
	i: 
	o: 93(t), 503(f)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76da04c>, 261: <unpyclib.structure.node instance at 0xb76da42c>, 309: <unpyclib.structure.node instance at 0xb76e418c>, '136&158': <unpyclib.structure.node instance at 0xb76e4fac>, 93: <unpyclib.structure.node instance at 0xb76da0ac>, 227: <unpyclib.structure.node instance at 0xb76da3ac>, 503: <unpyclib.structure.node instance at 0xb76dac2c>}
__all__ = ['YoutubeData']
from peewee.misc_utils import MetaSingleton
from urllib import quote_plus, urlencode
import urllib2
class YoutubeData(object):
	__metaclass__ = MetaSingleton
	def __init__(self):
		import gdata.service
		self.service = gdata.service.GDataService(server='gdata.youtube.com')
		self.url_open = None
		return None

	_standard_feeds = ('Recently featured', 'Top rated', 'Top favorites', 'Most viewed', 'Most recent', 'Most discussed', 'Most linked', 'Most responded')
	def _get_flv_uri(self, video_uri):
		if not self.url_open:
			self.url_open = urllib2.build_opener(urllib2.ProxyHandler(), urllib2.HTTPCookieProcessor()).open
		base_uri = 'http://www.youtube.com'
		uri_values = video_uri.split('?', 1)[1].split('=')
		player_site = self.url_open(video_uri)
		data = player_site.read()
		idx = data.index('"t":')
		data = data[idx + 5:idx + 200].lstrip(' "')
		_t_arg = data[:data.index('"')]
		del data
		vid_id = uri_values[uri_values.index('v') + 1]
		request = urllib2.Request('%s/watch_video?v=%s' % (base_uri, vid_id))
		request.add_header('User-Agent', 'WyWideWeb/1.0')
		site = self.url_open(request)
		return '%s/get_video?video_id=%s&t=%s%s' % (base_uri, vid_id, _t_arg, '&fmt=18')

	def _get_entries(self, path):
		return self.service.Get('/feeds/api/' + path).entry

	def _get_dict_from_entry(self, e):
		group_ext = e.FindExtensions(tag='group')[0]
		try:
			view_count = e.FindExtensions(tag='statistics')[0].attributes['viewCount']
		except IndexError:
			view_count = 'NA'
		try:
			rating_ext = e.FindExtensions(tag='rating')[0]
		except IndexError:
			rating_ext = None
		if rating_ext is not None:
			pass
		return dict(title=group_ext.FindChildren(tag='title')[0].text, thumbnail=group_ext.FindChildren(tag='thumbnail')[0].attributes['url'], player_url=group_ext.FindChildren(tag='player')[0].attributes['url'], uri=(lambda uri=group_ext.FindChildren(tag='player')[0].attributes['url']: self._get_flv_uri(uri)), view_count=view_count, rating=0, description='')

	def simple_search(self, name):
		pass

	def search(self, what, start_idx=1, max_res=50, lang=None, orderby=None):
		if start_idx > 0:
			pass
		if max_res <= 50:
			pass
		params = {'start-index': 1, 'max-results': 50}
		if isinstance(what, int):
			root_uri = 'standardfeeds/%s' % '_'.join(self._standard_feeds[what].lower().split())
		else:
			params['vq'] = what
			root_uri = 'videos'
		if lang is not None and 'vq' in params:
			params['lr'] = lang
			params['restriction'] = lang.upper()
		if orderby is not None:
			_[1], params['orderby'] = [], orderby



